FROM golang:1.17.2 as build

ENV GO111MODULE=auto \
    GOPROXY=https://goproxy.cn,direct

WORKDIR /go/release

ADD ./nch2/http/main/http_server.go .

RUN GOOS=linux CGO_ENABLED=0 GOARCH=amd64 go build -o http_server http_server.go


FROM scratch as prod

WORKDIR /app

COPY --from=build /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
COPY --from=build /go/release/http_server .

ENV GIN_MODE=release \
    PORT=80

EXPOSE 80
ENTRYPOINT ["./http_server"]



